<!DOCTYPE html>
<html>
<head>

    <title>A basic Bar chart with dollar syntax example</title>

    <meta name="robots" content="noindex,nofollow" />
    <meta name="description" content="A basic example of an RGraph Bar chart that makes use of the dollar syntax to add an event listener to a single bar." />
    <meta name="googlebot" content="NOODP">

    <!-- 1/3. Include the RGraph libraries -->
    <script src="../libraries/RGraph.common.core.js" ></script>
    <script src="../libraries/RGraph.common.dynamic.js" ></script>
    <script src="../libraries/RGraph.bar.js" ></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <!--[if lt IE 9]><script src="../excanvas/excanvas.js"></script><![endif]-->

</head>
<body>

    <h1>A basic Bar chart with dollar syntax example</h1>

    <!-- 2/3. This is the canvas that the graph is drawn on -->
    <canvas id="myBar" width="1000" height="250">[No canvas support]</canvas>

    <!--
        3/3. This creates and displays the graph. As it is here, you can call this from the window.onload event,
             allowing you to put it in your pages header.
    -->
    <script>
        $(document).ready(function ()
        {
            var bar = new RGraph.Bar({
                id: 'myBar',
                data: [12,13,16,15,16,19,19,12,23,16,13,24],
                options: {
                    gutter: {
                        left: 35
                    },
                    colors: ['red'],
                    title: 'A basic chart',
                    labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
                }
            }).draw()
            
            bar.$2.onclick = function (e, shape)
            {
                alert('The third bar was clicked.');
            }
            
            bar.$2.onmousemove = function (e, shape)
            {
                e.target.style.cursor = 'pointer';
            }
        })
    </script>

</body>
</html>